import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] dp = new int[100001];
        dp[1] = 1;
        dp[2] = 2;
        int t = 0;
        for (int i = 3; i < dp.length; i++) {
            dp[i] = dp[i - 1] + dp[i - 2];
            if(dp[i] > 1000000){
                t = i;
                break;
            }
        }
        for (int i = 3; i < dp.length; i++) {
            dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000;
        }
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int num = in.nextInt();
            if(num >= t){
                System.out.printf("%06d\n",dp[num]);
            }else{
                System.out.println(dp[num]);
            }
        }
    }
}